package main

import (
"fmt"
"github.com/liushuochen/gotable"
	"github.com/liushuochen/gotable/cell"
)

func main() {

	table, err := gotable.Create("country", "city")
	if err != nil {
		fmt.Println(err.Error())
		return
	}

	values := []map[string]string{{"country": "China", "city": "Beijing"},
		{"country": "Japan", "city": "Tokyo"},
		{"country": "North Korea                   ", "city": "Pyongyang"}}
	for _, value := range values {
		err := table.AddRow(value)
		if err != nil {
			fmt.Println(err.Error())
			return
		}
	}
	table.Align("country",cell.AlignLeft)
	table.Align("city",cell.AlignLeft)

	table.CloseBorder()
	fmt.Println(table)

}